package ipl;


import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class util {

	public static String list2String(ArrayList<IntPair> sorted) {
		StringBuffer rst = new StringBuffer(1024);
		for (IntPair pr : sorted) {
			rst.append(pr.first + "=" + pr.second + ";");
		}
		return rst.toString();
	}

	public static class IntPairComparator implements Comparator<IntPair> {
	    @Override
	    public int compare(IntPair o1, IntPair o2) {
	        return o1.compareTo(o2);
	    }
	}
	
	public static void sortList(ArrayList<IntPair> sorted) {
		// sort
		Collections.sort(sorted, new IntPairComparator());
	}

}
